﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ed.Entity;
using Ed.Service;
using Ed.Web.Filters;
using Spring.Context.Support;

namespace Ed.Web.Areas.Home.Controllers
{
    public class DefaultController : Controller
    {
        #region  依赖注入(PregnanterInfoApiController注入PregnanterInfoService) 2014-10-15 22:11:19 By 屠玲玲
        public ISysUserService SysUserService { set; get; }
        /// <summary>
        /// 依赖注入(PregnanterInfoApiController注入PregnanterInfoService) 2014-10-15 22:11:19 By 屠玲玲
        /// </summary>


        #endregion
        //
        // GET: /Home/Default/1
        //默认页
        [UserAuthorize]
        [RolePowerAuthorize]
        public ActionResult Index()
        {
            //接收RolePowerAuthorize特性里面设置的模块权限集合
            var powers = (List<Dictionary<string, object>>)ViewBag.Powers;
            int roleId = int.Parse(Session[EdKeys.SESSION_ROLE_ID].ToString());
            int userid = int.Parse(Session[EdKeys.SESSION_USER_ID].ToString());
            TSysUser sysuser = SysUserService.GetSysUser(u => u.Id == userid);
            var username = sysuser.UserLname;
            ViewBag.RoleId = roleId;
            ViewBag.username = username;
            return View(powers);
        }




    }
}